package cc.eguid.tools;

import java.io.Serializable;
import java.net.SocketAddress;
import java.time.Instant;

/**
 * 已连接客户端信息
 */
public class ClientInfo implements Serializable {
    private final String clientId;
    private final String remoteAddress;
    private final Instant connectedAt;

    public ClientInfo(String clientId, SocketAddress remoteAddress, Instant connectedAt) {
        this.clientId = clientId;
        this.remoteAddress = remoteAddress == null ? "" : remoteAddress.toString();
        this.connectedAt = connectedAt;
    }

    public String getClientId() {
        return clientId;
    }

    public String getRemoteAddress() {
        return remoteAddress;
    }

    public Instant getConnectedAt() {
        return connectedAt;
    }
}


